package com.example.universitylibraryback.service.impl;

import com.example.universitylibraryback.mapper.ReaderMapper;
import com.example.universitylibraryback.entity.Reader;
import com.example.universitylibraryback.service.ReaderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;

@Service
public class ReaderServiceImpl implements ReaderService {
    
    @Autowired
    private ReaderMapper readerMapper;
    
    @Override
    public List<Reader> findAll() {
        return readerMapper.findAll();
    }
    
    @Override
    public Reader findById(String readerId) {
        return readerMapper.findById(readerId);
    }
    
    @Override
    public boolean save(Reader reader) {
        return readerMapper.insert(reader) > 0;
    }
    
    @Override
    public boolean update(Reader reader) {
        return readerMapper.update(reader) > 0;
    }
    
    @Override
    public boolean delete(String readerId) {
        return readerMapper.delete(readerId) > 0;
    }
}